Skip to content

CL vault system: production fixes, pilot tooling, and cleanup - #2

Merged
CryptJS13 merged 4 commits into
devfrom
cl-vault
Jul 15, 2026
Merged

CL vault system: production fixes, pilot tooling, and cleanup#2
CryptJS13 merged 4 commits into
devfrom
cl-vault

Conversation

@CryptJS13

Copy link
Copy Markdown
Owner

Summary

Complete CL (Aerodrome Slipstream concentrated-liquidity) vault system for Base: production-hardened contracts, pilot deployment tooling, and a full dead-code cleanup pass.

Contract changes

  • CLVault — NAV counts vault + strategy idle; deposit reads NAV before token transfer (fixes ~5% share-dilution); range-aware idle rebalance via planSwapForMint; position NFT re-staked into the gauge after every deposit/withdraw/rebalance; rebalance tail runs a full doHardWork so accumulated strategy idle is absorbed into the new position; sweepDust replaced by sweepStrayToken (token0/token1 blocked — they back PPS)
  • CLRebalanceHelperplanSwapForMint plans at spot (not TWAP) with a one-step price-impact correction using pool active liquidity; burn/mint mins take per-side min(TWAP, spot) so out-of-range burns don't revert; precision-edge clamps at range boundaries
  • AerodromeCLStrategy — idle absorption decoupled from the reward threshold (_absorbIdleIntoPosition runs on every doHardWork); stakePosition for vault-driven restake; preInteract dust sweep keeps strategy idle inside NAV/payout math
  • CLWrapper — fee-aware previews, per-leg swap slippage guard (WrapperSwapBelowPrecision fails loud instead of bleeding value), truncation guard, immutable token caching, wrapper always ends interactions at zero balance
  • CLChainlinkChecker — Chainlink Automation upkeep for rebalances; replaces the Gelato-style CLRebalanceChecker (deleted)

Cleanup

82-agent audit with adversarial verification; 73 confirmed findings applied: dead functions, legacy paused/sellFloor/slot-array machinery, unused events/imports/params, 4 dead files, interface trims, stale comments. CLVault bytecode 22,422 bytes (2.1 KB under EIP-170). Zero CL compile warnings.

Deploy tooling

Bridge-Storage flow (EOA does setup, final step flips every contract to the multisig-governed Storage), recovery script for partial deploys, checker deploy script, pilot configs for cbETH/ETH1 and tBTC/cbBTC.

Test plan

  • 169 passing across 12 CL suites at FORK_BLOCK=32897925: user-interaction audit (34), wrapper audit (26), user fairness both vaults (32), user deep-invariants (17), rebalance deep-dive incl. 100-case fuzz (8), live-pool planner comparison both pools (8), adversarial guards (4), mins helper (8), invariants (2), cbeth-eth1 (2), wrapper (8), live-controls (20)
  • Rebalance planner on live pools: avg/max leftover 0 bps (cbETH & BTC) vs legacy ~4,100 bps avg

🤖 Generated with Claude Code

CryptJS13 and others added 4 commits May 6, 2026 12:28
Contracts:
- CLVault: NAV includes vault+strategy idle; deposit reads NAV pre-transfer
  (fixes share dilution); range-aware idle rebalance via planSwapForMint;
  position NFT re-staked into gauge after every user interaction; rebalance
  tail runs a full doHardWork so strategy idle is absorbed into the new
  position; sweepDust replaced by sweepStrayToken (token0/1 protected)
- CLRebalanceHelper: planSwapForMint plans at SPOT (not TWAP) with one-step
  price-impact correction from pool liquidity; burn/mint mins take per-side
  min(TWAP, spot); precision-edge clamps at range boundaries
- AerodromeCLStrategy: idle absorption decoupled from reward threshold
  (_absorbIdleIntoPosition); stakePosition for vault-driven restaking;
  preInteract dust sweep; reward path restructured (single pre-fee gate)
- CLWrapper: fee-aware previews, per-leg swap slippage guard, truncation
  guard, immutable token caching, zero-balance invariant after every call
- CLChainlinkChecker: new Chainlink Automation upkeep for rebalances
  (replaces Gelato-style CLRebalanceChecker)

Cleanup (82-agent audit, 73 verified findings): removed dead functions,
legacy paused/sellFloor/slot-array machinery, unused events/imports/params,
4 dead files; interfaces trimmed to actual consumer surface; stale comments
corrected. CLVault bytecode 22,422 bytes. Zero CL compile warnings.

Deploy tooling: bridge-Storage deploy flow (EOA setup, multisig finalize),
recovery + checker deploy scripts, pilot configs for cbETH/ETH1 and
tBTC/cbBTC.

Tests: 169 passing across 12 CL suites (user fairness, rebalance deep-dive
with live-pool fuzzing, wrapper audit, invariants, adversarial guards).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@CryptJS13
CryptJS13 merged commit e7eb234 into dev Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant